<?php
/**
 * Name: LoginController.class.php
 * Description:
 * User: DIY
 * Date: 2016/9/6
 * Time: 15:55
 */

namespace Admin\Controller;

use Common\Logic\AdminUserLogic;
use Think\Controller;

class LoginController extends Controller{

    public function index(){
        if(IS_POST){
            //验证码
            $check = verify_image(I('verify_img'));
            if(!$check){
                $this->ajaxReturn(array('status'=>'95','msg'=>'验证码错误'));
            }
            $AdminUserLogic = new AdminUserLogic();
            $result = $AdminUserLogic->Login(I('username'),I('password'));
            $this->ajaxReturn($result);
        }
        else{
            if(check_login()){
                $this->success('用户已登录',U('Admin/Index/index'));
            }
            else{
                $this->display();
            }
        }
    }

}